package com.hzdl.car.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzdl.car.bean.CarRentInfo;
import com.hzdl.car.bean.Customer;
import com.hzdl.car.mapper.CarRentInfoMapper;
import com.hzdl.car.service.CarRentInfoService;
import com.hzdl.car.vo.CarRentInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CarRentInfoServiceImpl implements CarRentInfoService {

    @Autowired
    private CarRentInfoMapper crim;
    @Override
    public PageInfo findByWhere(CarRentInfoVo carRentInfoVo) {
        PageHelper.startPage(carRentInfoVo.getPage(),carRentInfoVo.getLimit());
        List<CarRentInfo> crList = crim.findByWhere(carRentInfoVo);
        PageInfo pageInfo = new PageInfo(crList);
        return pageInfo;
    }

    @Override
    public int carRentInfo(CarRentInfoVo carRentInfoVo) {
        return crim.carRentInfo(carRentInfoVo);
    }

    @Override
    public CarRentInfo findByRentId(String rentid) {
        return crim.findByRentId(rentid);
    }

    @Override
    public Customer findCustnameByIdentity(String identity) {
        return crim.findCustnameByIdentity(identity);
    }
}
